/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author Mark
 */
@Entity
@Table(name = "tickets", catalog = "ticketsaler", schema = "")
@NamedQueries({@NamedQuery(name = "Tickets.findAll", query = "SELECT t FROM Tickets t"), @NamedQuery(name = "Tickets.findById", query = "SELECT t FROM Tickets t WHERE t.id = :id"), @NamedQuery(name = "Tickets.findByTflight", query = "SELECT t FROM Tickets t WHERE t.tflight = :tflight"), @NamedQuery(name = "Tickets.findByTfrom", query = "SELECT t FROM Tickets t WHERE t.tfrom = :tfrom"), @NamedQuery(name = "Tickets.findByTfromtime", query = "SELECT t FROM Tickets t WHERE t.tfromtime = :tfromtime"), @NamedQuery(name = "Tickets.findByTarrive", query = "SELECT t FROM Tickets t WHERE t.tarrive = :tarrive"), @NamedQuery(name = "Tickets.findByTarrivetime", query = "SELECT t FROM Tickets t WHERE t.tarrivetime = :tarrivetime"), @NamedQuery(name = "Tickets.findByTprice", query = "SELECT t FROM Tickets t WHERE t.tprice = :tprice"), @NamedQuery(name = "Tickets.findByTseats", query = "SELECT t FROM Tickets t WHERE t.tseats = :tseats")})
public class Tickets implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "TFLIGHT")
    private String tflight;
    @Basic(optional = false)
    @Column(name = "TFROM")
    private String tfrom;
    @Basic(optional = false)
    @Column(name = "TFROMTIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date tfromtime;
    @Basic(optional = false)
    @Column(name = "TARRIVE")
    private String tarrive;
    @Basic(optional = false)
    @Column(name = "TARRIVETIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date tarrivetime;
    @Basic(optional = false)
    @Column(name = "TPRICE")
    private int tprice;
    @Basic(optional = false)
    @Column(name = "TSEATS")
    private int tseats;

    public Tickets() {
    }

    public Tickets(Integer id) {
        this.id = id;
    }

    public Tickets(Integer id, String tflight, String tfrom, Date tfromtime, String tarrive, Date tarrivetime, int tprice, int tseats) {
        this.id = id;
        this.tflight = tflight;
        this.tfrom = tfrom;
        this.tfromtime = tfromtime;
        this.tarrive = tarrive;
        this.tarrivetime = tarrivetime;
        this.tprice = tprice;
        this.tseats = tseats;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getTflight() {
        return tflight;
    }

    public void setTflight(String tflight) {
        String oldTflight = this.tflight;
        this.tflight = tflight;
        changeSupport.firePropertyChange("tflight", oldTflight, tflight);
    }

    public String getTfrom() {
        return tfrom;
    }

    public void setTfrom(String tfrom) {
        String oldTfrom = this.tfrom;
        this.tfrom = tfrom;
        changeSupport.firePropertyChange("tfrom", oldTfrom, tfrom);
    }

    public Date getTfromtime() {
        return tfromtime;
    }

    public void setTfromtime(Date tfromtime) {
        Date oldTfromtime = this.tfromtime;
        this.tfromtime = tfromtime;
        changeSupport.firePropertyChange("tfromtime", oldTfromtime, tfromtime);
    }

    public String getTarrive() {
        return tarrive;
    }

    public void setTarrive(String tarrive) {
        String oldTarrive = this.tarrive;
        this.tarrive = tarrive;
        changeSupport.firePropertyChange("tarrive", oldTarrive, tarrive);
    }

    public Date getTarrivetime() {
        return tarrivetime;
    }

    public void setTarrivetime(Date tarrivetime) {
        Date oldTarrivetime = this.tarrivetime;
        this.tarrivetime = tarrivetime;
        changeSupport.firePropertyChange("tarrivetime", oldTarrivetime, tarrivetime);
    }

    public int getTprice() {
        return tprice;
    }

    public void setTprice(int tprice) {
        int oldTprice = this.tprice;
        this.tprice = tprice;
        changeSupport.firePropertyChange("tprice", oldTprice, tprice);
    }

    public int getTseats() {
        return tseats;
    }

    public void setTseats(int tseats) {
        int oldTseats = this.tseats;
        this.tseats = tseats;
        changeSupport.firePropertyChange("tseats", oldTseats, tseats);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tickets)) {
            return false;
        }
        Tickets other = (Tickets) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "view.Tickets[id=" + id + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
